Walker.Crypto.AsyncAESEncryption

Provides async-based AES-GCM encryption and decryption with password-derived keys. Includes file encryption helpers, progress tracking, and byte array support.

Types

AESEncryptedText

Holds AES-GCM encrypted data along with the IV.

  • Fields:

    • string IV: Base64-encoded initialization vector.
    • string EncryptedText: Base64-encoded ciphertext.
  • Methods:

    • string ToString(): Converts the encrypted data to the format IV|EncryptedText.
    • static AESEncryptedText FromUTF8String(string input): Parses the string in IV|EncryptedText format. Throws FormatException if invalid.

Methods

EncryptAsync(string plainText, SecureData password, Action progress = null)

Encrypts plain text using AES-GCM asynchronously. Returns an AESEncryptedText containing the IV and encrypted data.

  • Parameters:

    • plainText: Text to encrypt.
    • password: Secure password to derive the encryption key.
    • progress: Optional callback for progress tracking, with a value from 0.0 to 1.0.
  • Returns: Task


DecryptAsync(SimpleAESEncryption.AESEncryptedText encrypted, SecureData password, Action progress = null)

Decrypts an AESEncryptedText asynchronously and returns the result as a string.

  • Parameters:

    • encrypted: The encrypted data and IV.
    • password: Secure password to derive the decryption key.
    • progress: Optional callback for progress tracking.
  • Returns: Task


DecryptAsync(string encryptedText, string ivBase64, SecureData password, Action progress = null)

Decrypts a string with a given IV asynchronously using the provided password.

  • Parameters:

    • encryptedText: Base64-encoded encrypted data.
    • ivBase64: Base64-encoded IV.
    • password: Secure password to derive the decryption key.
    • progress: Optional callback for progress tracking.
  • Returns: Task


EncryptBytesAsync(byte[] data, SecureData password, Action progress = null)

Encrypts a byte array asynchronously. Returns the encrypted data wrapped in an AESEncryptedText.

  • Parameters:

    • data: The byte array to encrypt.
    • password: Secure password to derive the encryption key.
    • progress: Optional callback for progress tracking.
  • Returns: Task


DecryptBytesAsync(SimpleAESEncryption.AESEncryptedText encrypted, SecureData password, Action progress = null)

Decrypts an AESEncryptedText asynchronously and returns the result as a byte array.

  • Parameters:

    • encrypted: The encrypted data and IV.
    • password: Secure password to derive the decryption key.
    • progress: Optional callback for progress tracking.
  • Returns: Task<byte[]>